package SI::Person::Nation;

use base 'MyDB::Object';


__PACKAGE__->meta->setup(
    table => 'Nation',
    columns =>
    [
        code => { type => 'varchar', length => 3, not_null => 1 },
        value => { type => 'varchar', length => 60, not_null => 1 },
    ],
    allow_inline_column_values => 1,
    primary_key_columns => [ 'code' ],
);

sub init_tab {
	my $self = shift;
	my $stmt = 'CREATE TABLE IF NOT EXISTS Nation (
               code VARCHAR(3) PRIMARY KEY NOT NULL, /* 民族代码 */
               value VARCHAR(60) NOT NULL            /* 民族值   */
               );';
    my $db = $self->init_db;
    my $dbh = $db->dbh or die $db->error;
    $db->do_transaction(sub {$dbh->do($stmt)})
        or die $db->error;
    return 1;
}





1;
